<template>
    <div class="home">
        <Search @search="search"></Search>
        <CoffeeList ref="CoffeeList"></CoffeeList>
    </div>
</template>

<script>
import Search from './search'
import CoffeeList from './CoffeeList'
export default {
    name: 'Home',
    components: {
        Search,
        CoffeeList
    },
    methods: {
        search(key) {
            if (key) {
                this.$refs.CoffeeList.search(key)
            } else {
                this.$message.error('输入不能为空！');
            }
        }
    }
}
</script>